home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: How to give functions as parameters?
- Date: Wed, 31 Jan 96 19:13:32 GMT
- Organization: none
- Message-ID: <823115612snz@genesis.demon.co.uk>
- References: <Pine.SUN.3.91N2x.960130222756.11581A-100000@yellow59.nada.kth.se> <310F787E.7B14@cmt.lpr.mail.carel.fi>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <310F787E.7B14@cmt.lpr.mail.carel.fi>
- aril@cmt.lpr.mail.carel.fi "Ari Lukumies" writes:
-
- >Per Steneskog wrote:
- >>
- >> I have a little problem, I dont know how to send a fuction,
- >> as a parameter to another function..
- >>
- >> #include <stdio.h>
- >>
- >> void
- >> do_it(void (*it)())
- >
- >You are expecting a pointer to a function returning void...
- >
- >> {
- >> ((*(it))());
- >
- >Too much to type, just use
- > (*it)();
-
- That works but you can also write it as:
-
- it();
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-